package com.lch.distributed.serialize;

/**
 * @author: liuchenhui
 * @create: 2019-06-02 21:27
 **/
public class SerializerDemo {
    public static void main(String[] args) {
//        ISerializer serializer = new FastJsonSerializer();
        ISerializer serializer = new XMLSerializer();


        User user = new User();
        user.setName("刘晨辉");

        final byte[] bytes = serializer.writeObject(user);
        System.out.println("bytes.length=" + bytes.length);
        System.out.println(new String(bytes));

        user = serializer.readObject(bytes, User.class);
        System.out.println(user);
    }
}
